#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    int n = 0;
    int x = 0;
    int count = 0;
    scanf("%d%d", &n, &x);
    for (int i = 1; i <= n; i++)
    {
        int m = i;
        while (m)
        {
            if (m % 10 == x)
            {
                count++;
            }
            m /= 10;
        }
    }
    printf("%d", count);
    return 0;
}
#include <stdio.h>

int main()
{
    int i = 0;
    int j = 0;
    int arr[10] = { 0 };
    for (i = 0; i < 10; i++)
    {
        scanf("%d ", &arr[i]);
    }
    for (j = 9; j >= 0; j--)
    {
        printf("%d ", arr[j]);
    }
    return 0;
}
#include <stdio.h>

int main()
{
    int n = 0;
    int sum = 0;

    scanf("%d", &n);
    while (n--)
    {
        int num = 0;
        scanf("%d", &num);
        sum += num;
    }
    printf("%d", sum);
    return 0;
}
#include <stdio.h>

int main()
{
    int i = 0;
    int n = 0;
    int max = 0;
    int min = 100;
    scanf("%d", &n);
    while (n--)
    {
        int num = 0;
        scanf("%d ", &num);
        if (num > max)
            max = num;
        if (num < min)
            min = num;
    }
    printf("%d", max - min);
    return 0;
}
#include <stdio.h>

void BubbleSort(int arr[], int n)
{
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - 1 - i; j++)
        {
            if (arr[j] < arr[j + 1])
            {
                int temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }

}
int main()
{
    int n = 0;
    int arr[50] = { 0 };
    int i = 0;
    int j = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d ", &arr[i]);
    }
    BubbleSort(arr, n);
    for (j = 0; j < 5; j++)
    {
        printf("%d ", arr[j]);
    }
    return 0;
}